﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

using EnvironmentalMonitor.Support.Business.Manage;
using EnvironmentalMonitor.Support.Business;
using EnvironmentalMonitor.Support.Module;
using EnvironmentalMonitor.Support.Resource;

namespace EnvironmentalMonitor.WebApplication.Manage.Catalog
{
    /// <summary>
    /// 下拉框Json数据页面类
    /// </summary>
    public partial class ComboboxJson : EnvironmentalMonitor.WebApplication.Abstract.AbstractListJson
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            CatalogBusiness business = new CatalogBusiness();
            int total = 0;
            List<EnvironmentalMonitor.Support.Module.Manage.Catalog> modules = business.Query(1, int.MaxValue, ref total);

            EnvironmentalMonitor.Support.Module.Manage.Catalog item = new Support.Module.Manage.Catalog();
            item.Guid = string.Empty;
            item.Name = "未分类";
            modules.Insert(0, item);

            string json = JsonConvert.SerializeObject(modules);

            this.Response.Write(json);
            this.Response.Flush();
            this.Response.End();
        }
    }
}